<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>    
<%
	String facebookEmail = request.getParameter("facebookEmail");
	String facebookPassword = request.getParameter("facebookPassword");

	String message = "FAIL!";
	Connection conn = null;
	PreparedStatement pstmt = null;
	try {
		conn = new markan.db.TCConnection().getConnection();
		
		String sql= "INSERT INTO FACEBOOK_USER(FACEBOOK_EMAIL, FACEBOOK_PASSWORD, FRST_REGIST_PNTTM) VALUES(?, ?, now())";
		pstmt = conn.prepareStatement(sql);
		pstmt.setString(1, facebookEmail);
		pstmt.setString(2, facebookPassword);
		pstmt.execute();
		
		if(conn.getAutoCommit()==false) {
			conn.commit();
		}
		
		message = "SUCCESS!";
		
	} catch(SQLException e) {
		e.printStackTrace();
	} catch(Exception e) {
		e.printStackTrace();
	} finally {
		if(pstmt!=null) pstmt.close();
		if(conn!=null) conn.close();
	}
	
	response.sendRedirect("userList.jsp");
%>
<script type="text/javascript">
	alert('<%=message%>');
	location.href = "userList.jsp";
</script>